package com.luych.toolbox.data.service.dao;

import com.luych.toolbox.data.service.entity.DataProjectRDataSource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Optional;

public interface DataProjectRDataSourceDao extends JpaRepository<DataProjectRDataSource, String>, JpaSpecificationExecutor<DataProjectRDataSource> {

    List<DataProjectRDataSource> findByDataProjectId(String dataProjectId);

    List<DataProjectRDataSource> findByDataSourceId(String dataSourceId);

    int countByDataProjectId(String dataProjectId);

    int countByDataSourceId(String dataSourceId);

    Optional<DataProjectRDataSource> getByDataProjectIdAndDataSourceId(String dataProjectId, String dataSourceId);

    void deleteByDataProjectIdAndDataSourceId(String dataProjectId, String dataSourceId);

    void deleteByDataProjectId(String dataProjectId);

    void deleteByDataSourceId(String dataSourceId);

}
